package com.dongdong.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdong.mapper.TbTypeTemplateMapper;
import com.dongdong.pojo.TbSpecification;
import com.dongdong.pojo.TbTypeTemplate;
import com.dongdong.service.TemplateService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Deacription TODO
 * @Author Lenovo
 * @Date 2020/12/10 22:06
 * @Version 1.0
 **/
@Component
@Service
public class TemplateServiceImpl implements TemplateService {

    @Resource
    private TbTypeTemplateMapper tbTypeTemplateMapper;

    @Override
    public List<TbTypeTemplate> selectTemplate(String temName) {
        return tbTypeTemplateMapper.selectByName(temName);
    }

    @Override
    public int insertTemplate(TbTypeTemplate tbTypeTemplate) {
        return tbTypeTemplateMapper.insertSelective(tbTypeTemplate);
    }

    @Override
    public TbTypeTemplate getTemplateById(Long id) {
        return tbTypeTemplateMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateTemplate(TbTypeTemplate tbTypeTemplate) {
        return tbTypeTemplateMapper.updateByPrimaryKeySelective(tbTypeTemplate);
    }

    @Override
    public int deleteBatch(Long[] ids) {
        return tbTypeTemplateMapper.deleteBatch(ids);
    }

    @Override
    public TbTypeTemplate getTemp(Long id) {
        return tbTypeTemplateMapper.selectByPrimaryKey(id);
    }

    @Override
    public TbTypeTemplate getSpec(Long id) {
        return tbTypeTemplateMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<TbTypeTemplate> getTemplate() {
        return tbTypeTemplateMapper.selectByExample(null);
    }

}

